<?php
include 'gmap_des_list.php';

$count = count($des_name);
if ($count == 1) {
	$name = $des_name[0]['name'];
	$address = $des_name[0]['address'];
	$phone = $des_name[0]['phone'];
	$lat = $des_name[0]['lat'];
	$lng = $des_name[0]['lng'];
	
echo <<< HERE
<a href="static.php?address=$address&compName=$name">$name</a><br/>
$address<br/>
<div data-role="controlgroup" data-type="horizontal">
<a data-role="button" href="static.php?address=$address&compName=$name" rel="external">Map</a>
<a data-role="button" href="route.php?address=$address&comp_name=$name&lat=$lat&lng=$lng" rel="external">Show Route</a>
</div>
HERE;
}
if ($count > 1) {
	for ($i = 0; $i < $count; $i++) {
		$name = $des_name[$i]['name'];
		$address = $des_name[$i]['address'];
		$phone = $des_name[$i]['phone'];
		$lat = $des_name[$i]['lat'];
		$lng = $des_name[$i]['lng'];
echo <<< HERE
<br/>
<a href="static.php?address=$address&compName=$name" rel="external">$name</a><br/>
$address<br/>
Phone: <a href="tel:$phone">$phone</a><br/>
<div data-role="controlgroup" data-type="horizontal">
<a data-role="button" href="tel:$phone">Call</a>
<a data-role="button" href="static.php?address=$address&compName=$name" rel="external">Map</a>
<a data-role="button" href="route.php?address=$address&comp_name=$name&lat=$lat&lng=$lng" rel="external">Directions</a>
</div>
<hr>
HERE;
	}
}
?>